<?php
class Avatar_Form_Admin_Avatarcollections_Avatar extends Engine_Form {
	public function init() {
		// Init form
		$this->setTitle ( 'Add Avatars' )->setAttrib ( 'id', 'form-upload' )->setAttrib ( 'name', 'add_avatar' )->setAttrib ( 'enctype', 'multipart/form-data' )->setAction ( Zend_Controller_Front::getInstance ()->getRouter ()->assemble ( array ('module' => 'avatar', 'controller' => 'avatarcollections', 'action' => 'upload-avatars' ) ) );
		//   $this->addElement('FancyUpload', 'file');
		$fancyUpload = new Engine_Form_Element_FancyUpload ( 'file' );
		$fancyUpload->clearDecorators ()->addDecorator ( 'FormFancyUpload' )->addDecorator ( 'viewScript', array ('viewScript' => '_FancyUpload.tpl', 'placement' => '' ) );
		Engine_Form::addDefaultDecorators ( $fancyUpload );
		$this->addElement ( $fancyUpload );
	
	}
	
	public function set_collection_id($collection_id) {
		$collection_id = ( int ) $collection_id;
		if ($collection_id) {
			$this->getElement ( 'file' )->getDecorator ( 'viewScript' )->setOption ( 'data', array ('collection_id' => $collection_id ) );
		}
	}
}
?>
